In [1]:
import plotly.offline as pyo

from plotly.graph_objs import *

import chart_studio.plotly as py

import pandas as pd
from pandas import DataFrame
In [2]:
import plotly.figure_factory as ff
In [3]:
pyo.offline.init_notebook_mode()
In [4]:
df = pd.read_csv(r'../Data/UKCountryPopulation.csv', index_col = 0)

df = df[['Name','Population (2011)', 'Area (km2)']]
df
Out[4]:
Name Population (2011) Area (km2)
0 England 53107169 130395
1 Scotland 5299900 78772
2 Wales 3063758 20779
3 Northern Ireland 1814318 13843
In [5]:
UKCountryInfo = ff.create_table(df, index='True')
pyo.iplot(UKCountryInfo)
In [6]:
df.set_index('Name', drop=True, inplace = True)
df
Out[6]:
Population (2011) Area (km2)
Name
England 53107169 130395
Scotland 5299900 78772
Wales 3063758 20779
Northern Ireland 1814318 13843
In [7]:
UKCountryInfo = ff.create_table(df, index=True)
pyo.iplot(UKCountryInfo)
In [8]:
UKCountryInfo = ff.create_table(df, index=True, index_title='Country')
pyo.iplot(UKCountryInfo)
In [9]:
df[" "] = ""
df["  "] = ""
df["   "] = ""
df
Out[9]:
Population (2011) Area (km2)
Name
England 53107169 130395
Scotland 5299900 78772
Wales 3063758 20779
Northern Ireland 1814318 13843
In [10]:
df = df[[' ', 'Population (2011)', '  ', 'Area (km2)', '   ']]
df
Out[10]:
Population (2011) Area (km2)
Name
England 53107169 130395
Scotland 5299900 78772
Wales 3063758 20779
Northern Ireland 1814318 13843
In [11]:
UKCountryInfo = ff.create_table(df, index=True, index_title='Country')
pyo.iplot(UKCountryInfo)
In [12]:
df = pd.read_csv(r'../Data/UKCountryPopulation.csv', index_col = 0)
df = df[['Name','Population (2011)', 'Area (km2)']]
df.set_index('Name', drop=True, inplace = True)

UKCountryInfo = ff.create_table(df, index=True, index_title='Country')
UKCountryInfo['layout'].update({'width' : 500})
pyo.iplot(UKCountryInfo)
In [ ]: